// SciTE - Scintilla based Text Editor
/** @file PropSetFile.h
 ** Definition of platform independent base class of editor.
 **/
// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

/**
 */

typedef std::map<std::wstring, std::wstring> mapss;

class PropSetFile : public PropertyGet {
	bool lowerKeys;
	SString GetWildUsingStart(const PropSetFile &psStart, const WCHAR *keybase, const WCHAR *filename);
	static bool caseSensitiveFilenames;
	mapss props;
	std::wstring enumnext;
public:
	PropSetFile *superPS;
	PropSetFile(bool lowerKeys_=false);
	virtual ~PropSetFile();
	void Set(const WCHAR *key, const WCHAR *val, int lenKey=-1, int lenVal=-1);
	void Set(const WCHAR *keyVal);
	void Unset(const WCHAR *key, int lenKey=-1);
	void SetMultiple(const WCHAR *s);
	SString Get(const WCHAR *key) const;
	SString GetExpanded(const WCHAR *key) const;
	SString Expand(const WCHAR *withVars, int maxExpands=100) const;
	int GetInt(const WCHAR *key, int defaultValue=0) const;
	void Clear();
	WCHAR *ToString() const;	// Caller must delete[] the return value

	bool ReadLine(const WCHAR *data, bool ifIsTrue, FilePath directoryForImports, FilePath imports[] = 0, int sizeImports = 0);
	void ReadFromMemory(const WCHAR *data, int len, FilePath directoryForImports, FilePath imports[] = 0, int sizeImports = 0);
	bool Read(FilePath filename, FilePath directoryForImports, FilePath imports[] = 0, int sizeImports = 0);
	void SetInteger(const WCHAR *key, int i);
	SString GetWild(const WCHAR *keybase, const WCHAR *filename);
	SString GetNewExpand(const WCHAR *keybase, const WCHAR *filename=L"");
	bool GetFirst(const WCHAR *&key, const WCHAR *&val);
	bool GetNext(const WCHAR *&key, const WCHAR *&val);
	static void SetCaseSensitiveFilenames(bool caseSensitiveFilenames_) {
		caseSensitiveFilenames = caseSensitiveFilenames_;
	}

private:
	// copy-value semantics not implemented
	PropSetFile(const PropSetFile &copy);
	void operator=(const PropSetFile &assign);
};
